#!/bin/bash

if [ $# -eq 1 -a $1 == "-q" ];then
  cpu=`top -b -d1 -n1 | grep "Cpu(s)" |sed 's/%/ /g' | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}'`
  mem=`free -m | awk 'NR==2{printf "%.2f", $3*100/$2 }'`
  echo "vnc_load ${cpu} ${mem}"
  exit
fi

